package dk.eal.kbr.mule.component.exchange;

import org.mule.api.MuleEventContext;

public class MoveMessageVariablesToPayload implements
		org.mule.api.lifecycle.Callable {

	@Override
	public Object onCall(MuleEventContext eventContext) throws Exception {
		ExchangeCalenderItem calenderItem = (ExchangeCalenderItem) eventContext
				.transformMessage(ExchangeCalenderItem.class);
		String email = eventContext.getMessage().getInvocationProperty("email");
		String password = eventContext.getMessage().getInvocationProperty(
				"password");
		String exchangeId = "";
		try {
			exchangeId = eventContext.getMessage().getInvocationProperty(
					"exchangeId");
		} catch (Exception e) {
		}
		calenderItem.setExchangeItemId(exchangeId);
		calenderItem.setEmail(email);
		calenderItem.setPassword(password);
		return calenderItem;
	}

}
